#ifndef SOUNDPRISON_H
#define SOUNDPRISON_H

#include <QHash>
#include <QList>
#include <QMainWindow>
#include <QSystemTrayIcon>

#include <Windows.h>
#include "devicefactory.h"

class QSettings;

class QxtGlobalShortcut;

class DeviceWidget;

namespace Ui {
	class SoundPrison;
}

class SoundPrison : public QMainWindow
	{
		Q_OBJECT

		public:
			explicit SoundPrison(QWidget *parent = 0);
			~SoundPrison();

		protected:
			void closeEvent(QCloseEvent *);
			IMMDevice * determineDefaultDevice(EDataFlow);
			void init();

		private:
			Ui::SoundPrison *ui;
			DeviceWidget * default_input_device;
			DeviceWidget * default_output_device;
			IMMDeviceCollection * device_collection;
			IMMDeviceEnumerator * device_enum;
			DeviceFactory * device_factory;
			QList<DeviceWidget *> devices;
			bool edit_mode;
			QHash<QString, QxtGlobalShortcut *> global_shortcuts;
			bool input_devices_locked;
			bool output_devices_locked;
			QSettings * settings;
			QSystemTrayIcon * sys_tray;

		protected slots:
			void addDevice(const QString &);
			void applyPreset();
			void applyPresetByShortcut();
			void deletePreset();
			void help();
			void loadPreset(bool);
			void loadPresets();
			void newPreset();
			void removeDevice(const QString &);
			void savePreset();
			void setEditMode(bool);
			void systrayActivated(QSystemTrayIcon::ActivationReason);
			void updateDefaultDevice(const QString &, const QString &);
	};

#endif // SOUNDPRISON_H
